package com.yaozheng.vocationaltraining.service.impl;

import java.io.IOException;
import java.util.HashMap;

import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.EBean;

import net.sf.json.JSONObject;

import com.squareup.okhttp.Callback;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import com.yaozheng.vocationaltraining.iview.IBaseView;
import com.yaozheng.vocationaltraining.iview.ITokenBaseView;
import com.yaozheng.vocationaltraining.service.MemoryWealthService;
import com.yaozheng.vocationaltraining.utils.Constants;
import com.yaozheng.vocationaltraining.utils.ErrorUtils;
import com.yaozheng.vocationaltraining.utils.JsonUtils;
import com.yaozheng.vocationaltraining.utils.TypeUtils;
import com.yaozheng.vocationaltraining.utils.http.okhttp.OkHttpClientManager;

/**
 * 记忆财富服务
 * 
 * @author Administrator
 * 
 */
@EBean
public class MemoryWealthServiceImpl implements MemoryWealthService {

	ITokenBaseView iTokenBaseView;

	/**
	 * 初始化
	 * 
	 * @param iLoginView
	 */
	public void init(ITokenBaseView iTokenBaseView) {
		this.iTokenBaseView = iTokenBaseView;
	}

	/**
	 * 加载数据
	 */
	@Background
	@Override
	public void list(int offset) {
		try {
			OkHttpClientManager.getInstance().get(
					Constants.ROOTURL + "/review/list?offset=" + offset,
					iTokenBaseView.getToken(), iTokenBaseView);
		} catch (Exception e) {
			ErrorUtils.outErrorLog(e);
			if (iTokenBaseView.isResponseResult()) {
				iTokenBaseView
						.responseError(ErrorUtils.SERVER_CONNECTION_ERROR);
			}

		}
	}
}
